package com.lgy.service.impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.lgy.dao.RepertoryDao;
import com.lgy.pojo.Repertory;
import com.lgy.service.IRepertoryService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
@Service
public class RepertoryServiceImpl implements IRepertoryService {

    @Autowired
    private RepertoryDao repertoryDao;
    @Override
    public List<Repertory> findAllByCompanyId(Integer companyId) {
        return repertoryDao.findAllByCompanyId(companyId);
    }

    @Override
    public PageInfo<Repertory> findByCompanyId(Integer companyId,Integer page,Integer pageSize) {
        PageHelper.startPage(page,pageSize);
        PageInfo<Repertory> pageInfo = new PageInfo<>(repertoryDao.findByCompanyId(companyId));
        return pageInfo;
    }
}
